<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/10/12
  Time: 16:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%@include file="../../common/header.jsp"%>
    <%@include file="../../common/ruoyi.jsp"%>

    <script>


        function queryClass(){
            $.ajax({
                url:"${pageContext.request.contextPath}/score.action?method=queryClass",
                type:"post",
                dataType:"json",
                success:function (data) {
                    $.each(data,function (i,e) {
                        $("#class_id").append("<option value="+e.classid+" onclick=queryScore("+e.classid+")>"+e.classname+"</option>");
                    })
                },
                error:function (xhr,s,e) {
                    alert("错误："+xhr+s+e);
                }

            });
        }

     function queryScore(classid){

            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/score.action?method=queryScore&classid="+classid+"&exam_id="+exam_id,
                data:$("#course-form").serialize(),
                dataType:"json",
                success:function (msg) {
                    $("#tb_cou1").empty();

                    for (var i = 0; i < msg.length; i++) {

                        var tr="<tr>" +
                            "<td>"+msg[i].stuid+"</td>"+
                            "<td>"+msg[i].stu_name+"</td>"+
                            "<td>"+msg[i].scoce+"</td>"+
                            "</tr>";

                        $("#tb_cou1").append(tr);
                    }

                },error:function(e){
                    alert(e);
                }
            });
        }

        function queryExma (examID) {
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/score.action?method=queryExam&exam_id="+examID,
                data:$("#course-form").serialize(),
                dataType:"json",
                success:function (msg) {
                    $("#tb_cou1").empty();

                    for (var i = 0; i < msg.length; i++) {

                        var tr="<tr>" +
                            "<td>"+msg[i].stuid+"</td>"+
                            "<td>"+msg[i].stu_name+"</td>"+
                            "<td>"+msg[i].scoce+"</td>"+
                            "</tr>";

                        $("#tb_cou1").append(tr);
                    }

                },error:function(e){
                    alert(e);
                }
            });
        }


        var exam_id =0;
        $(function () {
            exam_id ='${param.exam_id}';
            /*queryExam(exam_id);*/
            queryClass()
        });


    </script>



</head>
<body>

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="course-form">
                <div class="select-list">
                    <a href="../exam/exam.jsp" style="color: #0e90d2;font-size: 20px">返回试卷页面</a>
                    <ul>
                        <li>

                            班级：<select name="class_id" id="class_id" >
                        </select>
                        </li>
                    </ul>
                </div>
            </form>
            <div class="col-sm-12 select-table table-striped">

                <table class="table table-bordered table-hover">
                    <caption>成绩信息</caption>
                    <thead>
                    <tr>
                        <td>学号</td>
                        <td>姓名</td>
                        <td>成绩</td>
                    </tr>
                    </thead>
                    <tbody id="tb_cou1">

                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html>
